﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;

namespace DevicesView.Logic
{
    public static class HttpRequest
    {
        public static List<T> HttpPost<T>(HttpItem url, object parameter = null)
        {
            HttpItem hi = url; 
                hi.Content = JsonConvert.SerializeObject(parameter).GetBytes(UTF8Encoding.UTF8);  
            HttpResult<List<T>> httpResult = WebLogic.GetHttpResult<List<T>>(hi);

            if (!httpResult.Success || httpResult.Result == null || httpResult.Result.Count == 0)
                return null;

            return httpResult.Result;

        }
    }
}
